<template>
	<view>
		<view v-for="(item,index) in cardinfo" :key="index">
			<zy-group :title="$t('public.productCode')+$t('public.colon')+ item.code" :btnList="btnList" model="card">
				<view class="content">
					<view class="title">{{$t('public.productStatus')}}{{$t('public.colon')}}</view>
					<view class="text">
						<i class="iconfont icon-yk_yuanquan_fill"
							:style="`color: ${item.status==0?'#ff0000':item.status==1?'#409efe':item.status==2?'#FFD764':'#67C23A'}`"></i>
						{{item.status==0?$t('public.packing'):item.status==1?$t('public.packed'):item.status==2?$t('public.inStoraged'):$t('public.outStoraged')}}
					</view>
				</view>
				<view class="content">
					<text class="title">{{$t('public.productBox')}}{{$t('public.colon')}}</text>
					<view class="text">{{item.no}}</view>
				</view>
				<view class="content">
					<text class="title">{{$t('public.productNum')}}{{$t('public.colon')}}</text>
					<view class="text">{{item.num | unitConverter}}
						<text style="color: #999;padding-left: 10rpx;">{{$t('public.piece')}}</text>
					</view>
				</view>
			</zy-group>
		</view>
		<!-- 弹出层 -->
		<zy-popup ref="popup" :title="$t('public.detail')">
			<zy-table :headList="headList" :dataList="dataList"></zy-table>
		</zy-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				btnList: [{
					text: this.$t('public.detail'),
					handle: this.goDetail,
				}],
				headList: [{
					key: 'color',
					name: this.$t('public.color')
				}, {
					key: 'size',
					name: this.$t('public.size')
				}, {
					key: 'num',
					name: this.$t('public.num')
				}, ],
				dataList: [],
			}
		},
		props: {
			cardinfo: {
				type: Array,
				default: []
			}
		},
		methods: {
			// 弹出层关闭
			close() {
				this.show = false
			},
			goDetail(item) {
				this.$refs.popup.open()
				this.dataList = item.boxDetailList
			},
		}
	};
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		align-items: center; //上下对齐
		padding: 20rpx;
		width: calc(100% - 40rpx);
	}

	.title {
		color: #999;
		width: 30%;
	}

	.text {
		text-align: right;
		width: 70%;
	}
</style>